{template '_header'}


<div class="page-heading"> 
	<span class='pull-right'>
		{ifp 'goods.virtual.data.add'}
							<a class='btn btn-primary  btn-sm' href="{php echo merchUrl('goods/virtual/data/add', array('typeid'=>$_GPC['typeid']))}"><i class="fa fa-plus"></i> 添加数据</a>
							{/if}
							{ifp 'goods.virtual.data.export'}
							<a class='btn btn-success  btn-sm' href="{php echo merchUrl('goods/virtual/data/export', array('typeid'=>$_GPC['typeid']))}"><i class="fa fa-download"></i> 导出已使用数据</a>
							{/if}
		<a class='btn btn-default btn-sm' href="{php echo merchUrl('goods/virtual/temp')}">返回列表</a> 
	</span>
	
	<h2>模板数据 <small>总数:{$total}; 模板名称:{$type['title']})</small></h2>
	</div>
	
<form action="./merchant.php" method="get" class="form-horizontal" role="form">
                    <input type="hidden" name="c" value="site" />
                    <input type="hidden" name="a" value="entry" />
                    <input type="hidden" name="m" value="ewei_shopv2" />
                    <input type="hidden" name="do" value="web" />
                    <input type="hidden" name="r" value="goods.virtual.data" />
                    <input type="hidden" name="typeid" value="{$type['id']}" />
<div class="page-toolbar row m-b-sm m-t-sm">
                            <div class="col-sm-4">
				 
			   <div class="input-group-btn">
			         <button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>
				{ifp 'goods.virtual.data.delete'}	
			        <button class="btn btn-default btn-sm dropdown-toggle" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{php echo merchUrl('goods/virtual/data/delete', array('typeid'=>$_GPC['typeid']))}"><i class='fa fa-trash'></i> 删除</button>
					{/if}
							
			   </div> 
                               </div>	
	  
			 
                            <div class="col-sm-6 pull-right">
			 		 
				<select name="status" class='form-control input-sm select-sm'>
					<option value="" {if $_GPC['status'] == ''} selected{/if}>状态</option>
					   <option value='0' {if $_GPC['status']=='0'}selected{/if}>未使用</option>
                                <option value='1' {if $_GPC['status']=='1'}selected{/if}>已使用</option>
				</select>	
				<div class="input-group">				 
                                        <input type="text" class="input-sm form-control" name='keyword' value="{$_GPC['keyword']}" placeholder="请输入主键(key)进行搜索"> <span class="input-group-btn">
						
                                     <button class="btn btn-sm btn-primary" type="submit"> 搜索</button> </span>
                                </div>
								
                            </div>
</div>
  </form>
 
                <table class="table table-hover table-responsive">
                    <thead>
                        <tr>
                            <th style="width:25px;"><input type='checkbox' /></th>
                  
                            
                            {loop $type['fields'] $key $name}
							<th> {$name} ({$key})</th>
                            {/loop}
                            <th style='text-align: center;width:80px;'>状态</th>
                           
                            <th>操作</th>
                        </tr>
                    </thead> 
                    <tbody>
                        {loop $items $item}
                            <tr>
                              	<td>
									{if empty($item['openid'])}<input type='checkbox'   value="{$item['id']}"/>{/if}
							</td>
                                
                                    
                                            {php $datas = iunserializer($item['fields'])}
                                {loop $type['fields'] $key $name}
                                       <td> {$datas[$key]}</td>
                                        {/loop}
                                  
                                
                                <td style='width:60px; text-align: center'>
                                    {if empty($item['openid'])}<span style="color:green">未使用</span>{else}<span style="color:red;">已使用</span>{/if}
                                </td> 
                              
                           
                                <td>
									<div class='btn-group btn-group-sm'>
                                    {if empty($item['openid'])}
				    {ifp 'goods.virtual.data.edit'}<a class='btn btn-default btn-sm' href="{php echo merchUrl('goods/virtual/data/edit', array('id' => $item['id'],'typeid'=>$item['typeid']))}"><i class='fa fa-edit'></i> {ifp 'goods.virtual.data.edit'}编辑{else}查看{/if}</a>{/if}
                                        {ifp 'goods.virtual.data.delete'}<a class='btn btn-default  btn-sm' data-toggle='ajaxRemove'  href="{php echo merchUrl('goods/virtual/data/delete', array('typeid'=>$item['typeid'],'id' => $item['id']))}" data-confirm="确认删除此条数据吗？"><i class='fa fa-trash'></i> 删除</a>{/if}
 				    {else}
				    <a class='btn btn-default  btn-sm' data-toggle='popover' data-content="
					   粉丝: <img src='{php echo tomedia($item['avatar'])}' style='width:20px;height:20px;padding:1px;border:1px solid #ccc' /> {$item['nickname']} <br/>
				  会员: {$item['realname']}/{$item['mobile']}<br/>
				  订单: <a href='{php echo merchUrl('order/detail',array('id'=>$item['orderid']))}' target='_blank'> [{$item['orderid']}]{$item['ordersn']}</a> <br/>
				  时间: {php echo date('Y-m-d H:i',$item['usetime'])}<br/>
				  价格: {$item['price']}" data-placement='top' data-html='true'><i class='fa fa-user'></i> 购买情况  </a>						
                                    {/if}
									</div>
                                </td>
                            </tr>
 
                              
                        {/loop}
                 
                    </tbody>
                </table>
        {$pager}
 

{template '_footer'}
